<template>
  <f7-page @page:reinit="getDataItems" >
    <f7-navbar title="吉林动画学院出差请表" back-link=""></f7-navbar>
    <f7-list inline-labels no-hairlines-md>

      <f7-list-item>
        <f7-label>项目名称</f7-label>
        <f7-input type="text" :value="formContent.projectName" :disabled="true"></f7-input>
      </f7-list-item>

      <f7-list-item  >
        <f7-label>申请部门</f7-label>
        <f7-input type="text"  :value="formContent.orgName" :disabled="true">  </f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>申请时间</f7-label>
        <f7-input type="text"  :value="formContent.creationDate" :disabled="true">  </f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>申请人</f7-label>
        <f7-input type="text"  :value="formContent.createBy" :disabled="true">  </f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>出差原因</f7-label>
        <f7-input type="textarea" :value="formContent.reason" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>出差开始时间</f7-label>
        <f7-input type="text"  :value="formContent.beginDate" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>出差结束时间</f7-label>
        <f7-input type="text"  :value="formContent.endDate"  :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>部门负责人</f7-label>
        <f7-input type="text" :value="formContent.depUser" :disabled="true"></f7-input>
      </f7-list-item>

      <f7-list-item >
        <f7-label>董事长</f7-label>
        <f7-input type="text"   :value="formContent.chairmanUser"   :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>会计</f7-label>
        <f7-input type="text"   :value="formContent.accountantUser"   :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>出纳</f7-label>
        <f7-input type="text"   :value="formContent.cashierUser"   :disabled="true"></f7-input>
      </f7-list-item>

    </f7-list>

    <f7-list accordion >
      <f7-list-item title="流程历史" v-bind:link="'/oa/activities/' + formContent.processInstanceId"></f7-list-item>
      <f7-list-item title="附件数据" v-bind:link="'/oa/attachments/' + formContent.id"></f7-list-item>
      <!--<f7-list-item title="业务审批" link="#" @click="popupOpened = true"></f7-list-item>-->
      <f7-list-item accordion-item  id="m2" :accordion-item-opened="true"  title="业务审批" v-show="paramsId ==-1 ? false : true">
        <f7-accordion-content>
          <f7-block>
            <f7-list inline-labels no-hairlines-md>
              <f7-list-item>
                <f7-input type="textarea" placeholder="请在这里填写批注"  v-bind:value="admitData.comment"   @input="admitData.comment =  $event.target.value"></f7-input>
              </f7-list-item>
            </f7-list>
            <f7-list inline-labels no-hairlines-md>
              <f7-list-item>
                <f7-input type="textarea" placeholder="请在这里填写批注"  v-bind:value="admitData.comment"   @input="admitData.comment =  $event.target.value"></f7-input>
              </f7-list-item>
              <f7-list-item>
                <img slot="media" v-bind:src="admitData.signature" />
              </f7-list-item>
            </f7-list>
            <f7-button raised href="/oa/personalwork/signature" >手写签名</f7-button>
            <f7-block strong>
              <f7-row>
                <f7-col width="50">
                  <f7-button fill raised @click="superiorDecision('同意')">同意</f7-button>
                </f7-col>
                <f7-col width="50">
                  <f7-button fill raised color="red" @click="superiorDecision('不同意')">不同意</f7-button>
                </f7-col>
              </f7-row>
            </f7-block>
          </f7-block>
        </f7-accordion-content>
      </f7-list-item>

    </f7-list>

  </f7-page>
</template>

<script>
    export default {
        name: "adminEvection",
        data() {
          return {
            paramsEntityId: this.$f7route.params.entityId,
            paramsId: this.$f7route.params.id,

            formContent: { },
            admitData: {
              signature: "",
              accepted: "不同意",
              comment: "",
              taskId: 0,
            },
          }
        },
        mounted() {
          this.$f7ready((f7) => {
            let that = this;
            f7.request.setup({
              headers: {
                'AccessToken': sessionStorage.getItem('accessToken'),
                'JSESSIONID': sessionStorage.getItem('userToken'),
              }
            });
              f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/evectionapplys/' +  that.paramsEntityId, { }, function (result) {
                that.formContent = result;
              });
          });
        },
        methods: {
          getDataItems: function () {
            console.log("init")
            let that = this;
            let app = that.$f7;
            let url = that.GLOBAL.RequestAddress + '/camel/rest/evectionapplys/' + that.paramsEntityId;
            app.request.json(url, {}, function (result) {
              that.formContent = result;
            })
            that.showSignaure();
          },
          superiorDecision: function (opinion) {
            let that = this;
            that.popupOpened = true;

            // let app = that.$f7
            // let url = that.GLOBAL.RequestAddress + "/camel/rest/evectionapplys/workflow/completeTask"
            // that.admitData.taskId = that.paramsId;
            // that.admitData.accepted = opinion;
            // //console.log(opinion)
            // app.request.json(url, that.admitData, function (result) {
            //   that.showAlert("提示", result.msg);
            // })
          },
          showAlert: function (title, text) {
            let that = this;
            let app = that.$f7
            app.dialog.alert(text, title, () => {
              that.$f7router.back();
            });
          },
          showSignaure : function () {
            let that = this;
            that.admitData.signature = that.$f7.data.admitSig;
            that.$f7.data.admitSig = "";
          },

        },

    }
</script>

<style scoped>

</style>
